package com.itheima.exerciseTest.test40_49;

import java.io.FileOutputStream;
import java.io.IOException;

public class Test49 {
    public static void main(String[] args) {
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("backBurner\\a.txt");
            fos.write(97);
            fos.write(98);
            fos.write(99);
            fos.write("\r\n".getBytes());

            byte[] bytes = {100,101,102,103};
            fos.write(bytes);
            fos.write("\r\n".getBytes());

            fos.write(bytes,2,2);
            fos.write("\r\n".getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(fos != null){
                try {
                    System.out.println("释放资源");
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
